package com.hteis.controller;

import com.hteis.entity.Results;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/home")
public class DemoController {
    @RequestMapping("/index")
    public String index(){
        return "index";
    }


    @RequestMapping(value = "/getJson",method = RequestMethod.GET)
    @ResponseBody
    public Results getJson(String name){
        System.out.println("get参数:"+name);
        Results results = new Results();
        results.setMessage("GET请求成功");
        results.setUserdata("GET-Json数据");
        results.setSuccess(true);
        return results;
    }

    @RequestMapping(value = "/postJson", method = RequestMethod.POST)
    @ResponseBody
    public Results pstJson(String name){
        System.out.println("post参数:"+name);
        Results results = new Results();
        results.setMessage("POST请求成功");
        results.setUserdata("POST-Json数据");
        results.setSuccess(true);
        return results;
    }





}
